<include file="Public/header"/>
<div class="row">
    <div class="col-md-12">
        <div class="ibox-content">
            <form class="layui-form" action="" autocomplete="off" id="bankform">
                <input type="hidden" name="id" value="<{$_GET['id']}>">
                <div class="layui-form-item">
                    <label class="layui-form-label">开户行：</label>
                    <div class="layui-input-block">
                        <select name="b[bankname]" lay-filter="" lay-search="" lay-verify="required">
                            <option value="">选择开户行</option>
                            <volist name="banklist" id="vobank">
                                <option <if condition="$b['bankname'] eq $vobank['bankname']">selected</if>
                                value="<{$vobank.bankname}>"><{$vobank.bankname}></option>
                            </volist>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">支行名称：</label>
                    <div class="layui-input-block">
                        <input type="text" name="b[subbranch]" lay-verify="" autocomplete="off" placeholder=""
                               class="layui-input" value="<{$b.subbranch}>">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">开户名：</label>
                    <div class="layui-input-block">
                        <input type="text" name="b[accountname]" lay-verify="" autocomplete="off" placeholder=""
                               class="layui-input" value="<{$b.accountname}>">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">银行卡号：</label>
                    <div class="layui-input-block">
                        <input type="number" name="b[cardnumber]" lay-verify="" autocomplete="off" placeholder=""
                               class="layui-input" value="<{$b.cardnumber}>">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">所属省：</label>
                        <div class="layui-input-inline">
                            <input type="tel" name="b[province]" lay-verify="" autocomplete="off"
                                   class="layui-input" value="<{$b.province}>">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">所属城市：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="b[city]" lay-verify="" autocomplete="off" class="layui-input"
                                   value="<{$b.city}>">
                        </div>
                    </div>
                </div>
                <include file="Public/send"/>
                <if condition="$googleCode_addbankcard">
                    <div class="layui-form-item">
                        <label class="layui-form-label">谷歌动态口令：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="googlecode" lay-verify="required" autocomplete="off"
                                   placeholder="" class="layui-input" value="">
                        </div>
                    </div>
                </if>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="save">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<include file="Public/footer"/>
<script>
    layui.use(['laydate', 'form', 'layer', 'table', 'element'], function() {
        var laydate = layui.laydate //日期
            , form = layui.form //分页
            , layer = layui.layer //弹层
            , table = layui.table //表格
            , element = layui.element; //元素操作
        //监听提交
        form.on('submit(save)', function(data){
            $.ajax({
                url:"<{:U('Account/addBankcard')}>",
                type:"post",
                data:$('#bankform').serialize(),
                success:function(res){
                    if(res.status){
                        layer.alert("编辑成功", {icon: 6},function () {
                            parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                    }else{
                        // layer.alert(res.msg, {icon: 5},function () {
                        //     parent.location.reload();
                        //     var index = parent.layer.getFrameIndex(window.name);
                        //     parent.layer.close(index);
                        // });
                        layer.msg(res.msg);
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>